package com.yazi.mxz.person.controller.user;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.myframework.smhj.common.tool.CipherUtil;
import com.myframework.smhj.common.tool.DateUtil;
import com.yazi.mxz.common.entity.beans.Member;

@Controller("user-IndexController")
@RequestMapping("/user")
public class CustomIndexController extends BaseController {
	private static Logger log = LoggerFactory.getLogger(CustomIndexController.class);
	
	@RequestMapping
	public String index(Model model) {
		debug(log, "进入个人信息页面");
		Member member = null;
		String code = null;
		String key = null;
		try {
			member = getMember(true);
			key = CipherUtil.generateDESKey("dkfjie4#$%djv");
			code = CipherUtil.DESEncrypt(DateUtil.getTimeStamp() + "]|[" + member.getName(), key);// TODO 参数分隔符:]|[
			code = code.replace(System.lineSeparator(), "XXXX");// TODO 替换掉换行符,避免在页面的脚本折行报错
		} catch (Exception e) {
			e.printStackTrace();
		}
		model.addAttribute("code", code);
		model.addAttribute("member", member);
		return "user/index";
	}
	
	@RequestMapping("/editPassword")
	public String edit() {
		debug(log, "进入密码修改页面");
		return "user/test_editPassword";
	}
}
